home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14301 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: nntp.teleport.com!usenet
  2. From: GHouck <hksys@teleport.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Nee help with a string and temp string
  5. Date: 13 Apr 1996 07:08:08 GMT
  6. Organization: systems hk
  7. Message-ID: <4knjso$i9s@nadine.teleport.com>
  8. References: <316C72CC.763A@cloudnet.com>
  9. NNTP-Posting-Host: ip-pdx14-40.teleport.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
  14.  
  15. "Randall J. Pfeifer" <rpfeifer@cloudnet.com> wrote:
  16. [snip]
  17. >As each component is evaluated the result is concatenad to a buffer string, with the
  18. >first component that is evaulated being copied instead of concatenaded.
  19. >Once the whole line is evaulated and corrected if necessary, I write that line to a file.
  20. >
  21. >I then read another line and start the process over again.
  22. >
  23. >My problem involves lines 2 through X.
  24. >  Reading the data is fine. However, when I evaluate the components and write them to the
  25. >  buffer the previous lines data still resides in the string.
  26. >
  27. >How can I get rid of the old lines data in my temp string.
  28. [snip]
  29. Randall,
  30. Based upon your question and not the code, I would suggest the following:
  31.  
  32. 1. init buffer ( e.g.: *buffer = NULL;)
  33. 2  read( firststring );
  34. 3  process( firststring );
  35. 4  strcat( buffer,firststring );
  36. 5  read( secondstring );
  37. 6  process( secondstring );
  38. 7  strcat( buffer,secondstring );
  39. 8  write( buffer );
  40. 9  repeat 1-8, until run out of data
  41.  
  42. Yours, Geoff Houck
  43.  
  44.